[Plugin] CA User Scripts

您所在的位置:网站首页 unraid user scripts [Plugin] CA User Scripts

[Plugin] CA User Scripts

2023-07-21 19:41| 来源: 网络整理| 查看: 265

This is probably a simple question, but after an hour of searching, I have yet to find a definitive answer.

 

I have a working script that weekly will rsync several folders from my array to an external USB drive mounted with Unassigned Devices.  I have two drives (External_USB_1 and External_USB_2) which I swap on the beginning of the month, and I keep the unconnected drive off site.  My current solution has me manually editing my script each time I swap drives, to specify the correct destination drive.  I would much rather set and forget the script, and have it check for the drive to be present before executing rsync.

 

What would be the best way to check if these drives are present and mounted? 

 

UPDATE:  I have a solution that seems to work, but if someone has a better one, I'm open to your ideas.

 

I ended up using mountpoint. 

 

#!/bin/bash #arrayStarted=true if mountpoint -q "/mnt/disks/External_3TB_1" then rsync -avh "/mnt/disks/Samsung_USB/UNRAID_Backups" "/mnt/user/Media/Music" "/mnt/user/Photos/ORIGINALS" "/mnt/user/Backup/appdata backup" "/mnt/disks/External_3TB_1" else echo "External_3TB_1 not mounted" fi if mountpoint -q "/mnt/disks/External_3TB_2" then rsync -avh "/mnt/disks/Samsung_USB/UNRAID_Backups" "/mnt/user/Media/Music" "/mnt/user/Photos/ORIGINALS" "/mnt/user/Backup/appdata backup" "/mnt/disks/External_3TB_2" else echo "External_3TB_2 not mounted" fi

 

Edited October 31, 2021 by ConnerVT Solution?


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3